home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Magazine / Database / Search.awebrx < prev   
Text File  |  2000-11-08  |  2KB  |  48 lines

  1. /*
  2.     Searches Amiga Active database on AACD
  3.     $VER: 1.1 Search.awebrx (7.11.2000)
  4.     (c) Neil Bothwick
  5.  
  6.     1.1  - Uses "parse source" to get the path to the database
  7. */
  8.  
  9. options results
  10. AWebPort = address()
  11.  
  12. parse source . ' ' . ' ' . ' ' ScriptName ' ' .
  13. DBdir = left(ScriptName, lastpos('/', ScriptName))
  14.  
  15. parse arg args
  16. call addlib('rexxsupport.library',0,-30,0)
  17. SearchStr = ''
  18. interpret args
  19. if SearchStr = '' then exit
  20. address command 'FlashFind >T:IndexSearch.results' DBdir'index "'SearchStr'" NH'
  21.  
  22. call open(out,'T:IndexSearch.html','W')
  23. call writeln(out,'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">')
  24. call writeln(out,'<html><head><title>Search results</title></head><body bgcolor=white>')
  25. call writeln(out,'<h3 align="center">Result of searching for "<font color="red">'SearchStr'</font>"</h3>')
  26.  
  27. if word(statef('T:IndexSearch.results'),2) = 0 then call writeln(out,'<h4 align="center">No matches found</h4>')
  28. else do
  29.     call writeln(out,'<table align="center" border="0">')
  30.     call writeln(out,'<tr><th width="80%">Title</th><th width="20%">Issue</th><tr>')
  31.     call open(in,'T:IndexSearch.results','R')
  32.     do until eof(in)
  33.         line = readln(in)
  34.         if line = '' then iterate
  35.         parse var line File '|' IssueDate '|' Title '|' .
  36.         parse var File IssueNum '-' .
  37.         call writeln(out,'<tr align="left" valign="top"><td><a href="file://localhost/'DBdir||File'">'Title'</a></td>')
  38.         call writeln(out,'<td align="center"><a href="file://localhost/'DBdir||'Issue'IssueNum'.html">'IssueDate'</a></td></tr>')
  39.         end
  40.     call close(in)
  41.     call writeln(out,'</table>')
  42.     end
  43.  
  44. call writeln(out,'</body></html>')
  45. call close(out)
  46.  
  47. 'Open "file://localhost/T:IndexSearch.html" reload'
  48.